CC=g++
RANLIB=ranlib

LIBSRC=outputdevice.cpp SyncedTasksQueue.cpp Task.cpp
LIBOBJ=$(LIBSRC:.cpp=.o)

INCS=-I.
CFLAGS = -Wall -g $(INCS)
LOADLIBES = -L./ 

OSMLIB = liboutputdevice.a
TARGETS = $(OSMLIB)

all: $(TARGETS) tester

$(TARGETS): $(LIBOBJ)
	$(AR) $(ARFLAGS) $@ $^
	$(RANLIB) $@

clean:
	$(RM) $(TARGETS) $(OSMLIB) $(OBJ) $(LIBOBJ) *~ *core *.o tester test.txt

tester3: tester3.o
	g++ -Wall tester3.o -o tester3 -lpthread -L.

tester3.o: threadTest.cpp
	g++ -Wall -lpthread -c threadTest.cpp -o tester3.o
	
depend:
	makedepend -- $(CFLAGS) -- $(SRC) $(LIBSRC)

tester: cleanObjects tester.o
	g++ -Wall tester.o -o tester -loutputdevice -lpthread -L. -I outputdevice.h

tester1: tester1.o
	g++ -Wall tester1.o -o tester1 -loutputdevice -lpthread -L.
	
tester1.o: OS_EX3.cpp
	g++ -Wall -lm -lpthread -c OS_EX3.cpp -o tester1.o

cleanObjects:
	rm *.o

tester.o: tester.cpp 
	g++ -Wall -lm -lpthread -c tester.cpp -o tester.o

Task.o: Task.cpp
	g++ -Wall -lm -lpthread -c Task.cpp  -o Task.o

outputdevice.o: outputdevice.cpp
	g++ -Wall -lm -lpthread -c outputdevice.cpp  -o outputdevice.o

SyncedTasksQueue.o: SyncedTasksQueue.cpp
	g++ -Wall -lm -lpthread -c SyncedTasksQueue.cpp -o SyncedTasksQueue.o